<style scoped>
.storeVip {
  margin-right: 15px;
  padding: 0 15px;
  background-color: white;
  height: 87.5vh;
  position: relative;
}
.third-inp p:first-child,
.second-inp p:first-child {
  margin: 3px 6px 0 0;
}
.third-inp p:not(:first-child),
.second-inp p:not(:first-child) {
  margin: 3px 6px 0 12px;
}
.wd {
  width: 160px;
}
.wd1 {
  width: 260px;
  margin-right: 10px;
}
.third-inp,
.second-inp {
  display: flex;
}
.second-integral {
  display: flex;
  justify-content: space-between;
  background: #f4f4f4;
  padding: 10px;
  margin: 10px 0;
  font-weight: 700;
}
.second-btn {
  width: 40%;
  display: flex;
  justify-content: space-between;
  /* margin-bottom: 10px; */
  margin-left: 10px;
}
.btn1 {
  display: flex;
}
.btn1 p {
  margin: 3px 6px 0 0;
}
.setting {
  width: 375px;
  height: 190px;
  background: white;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 3px 3px 3px #f4f4f4;
}
.setting > div:first-child {
  padding: 10px 15px;
  background: #f4f4f4;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
}
.setting > div:nth-child(2) {
  padding: 10px 15px;
}
</style>

<style>
.storeVip .third-inp .el-input__inner,
.storeVip .second-inp .el-input__inner,
.storeVip .second-integral .el-input__inner {
  height: 30px;
}
.storeVip .second-inp .el-date-editor .el-range__icon {
  line-height: 24px;
}
.storeVip .second-inp .el-date-editor .el-range-separator {
  width: 8%;
  line-height: 24px;
}
.storeVip .second-btn .btn1 .el-input__inner {
  height: 30px;
}
.storeVip .second-btn .btn1 .el-checkbox.is-bordered {
  padding: 4px 10px 0 10px;
  height: 30px;
}
.storeVip .setting .el-input__inner {
  height: 30px;
}
</style>

<template>
  <div class="storeVip">
    <el-tabs v-model="activeName">
      <el-tab-pane label="VIP建档" name="first">
        <div style="margin-bottom:10px;">
          <el-button
            :disabled="isRegular"
            type="primary"
            icon="el-icon-plus"
            @click="
              () => {
                (this.showNBData = 'block'), (this.title = '新建');
              }
            "
            >新建</el-button
          >
          <el-button :disabled="isRegular" @click="Delete" icon="el-icon-delete"
            >删除</el-button
          >
        </div>
        <el-table
          height="74vh"
          :header-cell-style="{
            background: '#f4f4f4',
            padding: 0,
            height: '40px',
          }"
          :cell-style="{ padding: 0, height: '26px' }"
          :data="tableData"
          highlight-current-row
          @row-click="rowClick"
          @row-dblclick="dbClick"
          style="width: 100%"
        >
          <el-table-column type="index" label="序号"> </el-table-column>
          <el-table-column prop="phone" label="VIP"> </el-table-column>
          <el-table-column prop="name" label="客户简称"> </el-table-column>
          <el-table-column prop="discount" label="折数"> </el-table-column>
          <el-table-column prop="birthday" label="生日"> </el-table-column>
          <el-table-column prop="address" label="地址"> </el-table-column>
          <el-table-column prop="remark" label="备注"> </el-table-column>
        </el-table>
      </el-tab-pane>

      <el-tab-pane label="充值/积分兑换设置" name="second">
        <div class="second-inp">
          <p>VIP</p>
          <el-select class="wd" clearable v-model="vip" placeholder="请选择">
            <el-option
              v-for="item in vipList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
              <span style="float:left">{{ item.value }}</span>
              <span style="float:right">{{ item.value1 }}</span>
            </el-option>
          </el-select>

          <!-- <p>客户简称</p>
        <el-input class="wd"></el-input> -->

          <p>日期</p>
          <el-date-picker
            unlink-panels
            v-model="timeDate"
            type="daterange"
            value-format="yyyy-MM-dd"
            format="yyyy-MM-dd"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          >
          </el-date-picker>

          <div class="second-btn">
            <div>
              <el-button @click="quary" type="primary" icon="el-icon-search"
                >查询</el-button
              >
              <el-button
                :disabled="isRegular"
                @click="dele"
                icon="el-icon-delete"
                >删除</el-button
              >
            </div>
            <div class="btn1">
              <p>显示方式</p>
              <el-select
                style="width:100px;margin-right:10px;"
                v-model="NumberListStr"
                placeholder="请选择"
              >
                <el-option
                  v-for="item in NumberList"
                  :key="item.value + Math.random()"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
              <el-checkbox v-model="checked" border>充值</el-checkbox>
            </div>
          </div>
        </div>

        <div class="second-integral">
          <div style="display:flex;">
            <p style="margin:3px 5px 0 0">充值类型</p>
            <el-select
              style="width:160px;margin-right:10px;"
              v-model="rechargeType"
              placeholder="请选择"
            >
              <el-option
                v-for="item in typeList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
            <el-input
              placeholder="请输入充值金额"
              class="wd1"
              v-model="recharge"
            ></el-input>
            <el-input
              placeholder="请输入现金券"
              class="wd1"
              v-model="cashCoupon"
            ></el-input>
            <el-button :disabled="isRegular" type="primary" @click="ChongZhi"
              >充值</el-button
            >
            <el-button
              :disabled="isRegular"
              @click="
                () => {
                  this.showSetting = 'block';
                }
              "
              >积分设置</el-button
            >
            <el-date-picker
              style="display:none;"
              v-model="time"
              type="date"
              value-format="yyyy-MM-dd"
            ></el-date-picker>
          </div>
          <div style="display:flex;">
            <p>充值序号：{{ serial }}</p>
            <p style="text-align:right;margin-left:40px;">
              现存余额：{{ Howmany }}
            </p>
          </div>
        </div>

        <el-table
          :header-cell-style="{
            background: '#f4f4f4',
            padding: 0,
            height: '40px',
          }"
          :cell-style="{ padding: 0, height: '26px' }"
          :data="tableData1"
          highlight-current-row
          :summary-method="getList"
          show-summary
          height="68vh"
          @row-click="rowClick2"
          style="width: 100%"
        >
          <template v-for="i in tab">
            <el-table-column
              :prop="i.prop"
              :label="i.label"
              :width="i.width"
              :key="i.prop + Math.random()"
            >
            </el-table-column>
          </template>
        </el-table>
      </el-tab-pane>

      <el-tab-pane label="店员建档" name="third">
        <div class="third-inp">
          <p>编号</p>
          <el-input class="wd" v-model="personnelNo" @input="inpt"></el-input>
          <p>职员名称</p>
          <el-input class="wd" v-model="personnelName"></el-input>
          <p>主推业绩比率</p>
          <el-input class="wd" v-model="mianRate"></el-input>
          <p style="display:none;">id</p>
          <el-input
            style="display:none;"
            class="wd"
            v-model="clerkId"
            disabled
          ></el-input>
        </div>

        <div style="margin:10px 0;">
          <el-button
            :disabled="isRegular"
            @click="preservationClerk"
            icon="el-icon-folder-checked"
            type="primary"
            >保存</el-button
          >
          <el-button
            :disabled="isRegular"
            @click="DeleteClerk"
            icon="el-icon-delete"
            >删除</el-button
          >
        </div>

        <el-table
          id="tip1"
          :data="aList"
          style="width: 100%"
          height="72vh"
          highlight-current-row
          @row-click="rowClick1"
          :header-cell-style="{
            background: '#f4f4f4',
            padding: 0,
            height: '40px',
          }"
          :cell-style="{ padding: 0, height: '26px' }"
        >
          <el-table-column prop="personnelNo" label="编号"> </el-table-column>
          <el-table-column prop="personnelName" label="职员名称">
          </el-table-column>
        </el-table>
      </el-tab-pane>
    </el-tabs>

    <!-- 积分设置 -->
    <div class="setting" :style="{ display: showSetting }">
      <div>
        <p>积分设置</p>
        <i
          class="el-icon-close"
          @click="
            () => {
              this.showSetting = 'none';
            }
          "
        ></i>
      </div>
      <div>
        <p>1.消费 100 元等于 100 积分</p>

        <div style="display:flex;margin:15px 0;">
          <el-input
            style="width:80px;margin-right:6px;"
            v-model="exchangeIntegral"
          ></el-input>
          <p>积分兑换</p>
          <el-input
            style="width:80px;margin:0 6px 0 25px;"
            v-model="exchangeMoney"
          ></el-input>
          <p>现金券</p>
        </div>

        <div style="text-align:end;">
          <el-button
            @click="
              () => {
                this.showSetting = 'none';
              }
            "
            >取消</el-button
          >
          <el-button @click="save" type="primary">确定</el-button>
        </div>
      </div>
    </div>

    <NB-Data
      :style="{ display: showNBData }"
      @closenewdata="
        () => {
          this.showNBData = 'none';
        }
      "
      @preservation="preservation"
      :title="title"
      :details="details"
      @put="put"
      @keepgoing="keepgoing"
    >
    </NB-Data>
  </div>
</template>

<script>
import NBData from "./childComps/newBuilData.vue";
import {
  postBuild,
  getVip,
  putVip,
  deleVip,
  getClerk,
  postClerk,
  getClerk1,
  putClerk,
  deleClerk,
  getmoney,
  getRecharge,
  Recharge,
  postIntegral,
  getIntegral,
  DeleteRecharge,
  getShop,
} from "../../../network/shop";
import today from "../../../components/mixins/today";
import { save } from "../../../network/customerOrderTotal";
export default {
  mixins: [today],
  name: "store_vip",
  components: {
    NBData,
  },
  created() {
    this.timeDate = [this.firstDay(), this.getNowTime1()];
    if (localStorage.getItem("whatState") == "直营") {
      this.isRegular = false;
    } else {
      this.isRegular = true;
    }
    //获取设置积分额
    getIntegral().then((res) => {
      this.exchangeIntegral = res.data.data.exchangeIntegral;
      this.exchangeMoney = res.data.data.exchangeMoney;
    });
    this.time = this.searchDateWithHour();

    //获取店员
    this._getClerk1();
    //获取主推业绩
    getClerk().then((res) => {
      this.mianRate = res.data.data.mianRate;
      this.sendId = res.data.data.id;
    });
    this.tab = this.table1;
    //获取vip信息
    this._getVip();
  },
  data() {
    return {
      isRegular: false,
      typeList: [
        { label: "转账", value: 1 },
        { label: "现金", value: 0 },
      ],
      rechargeType: "",
      sendId: "",
      time: "",
      checked: false,
      serial: "",
      recharge: "",
      cashCoupon: "",
      vip: "",
      vipList: [],
      clerkId: "",
      id: "",
      timeDate: "",
      title: "",
      tableData: [],
      tableData1: [],
      exchangeIntegral: "",
      exchangeMoney: "",
      Howmany: "",
      activeName: "first",
      showNBData: "none",
      showSetting: "none",
      aList: [],
      NumberList: [
        { label: "明细", value: "明细" },
        { label: "月汇总", value: "月汇总" },
        { label: "汇总", value: "汇总" },
      ],
      NumberListStr: "明细",
      table1: [
        { prop: "vipSellSequence", label: "单号" },
        { prop: "sellTime", label: "日期", width: "160" },
        { prop: "vip", label: "VIP" },
        { prop: "name", label: "客户简称" },
        { prop: "recharge", label: "充值" },
        { prop: "cashCoupon", label: "现金券" },
        { prop: "number", label: "数量" },
        { prop: "money", label: "金额" },
        { prop: "integralNumber", label: "积分" },
        // {prop:'integralMoney',label:'积分额'},
        { prop: "payg", label: "现收" },
      ],
      table2: [
        { prop: "month", label: "月份" },
        { prop: "recharge", label: "充值" },
        { prop: "cashCoupon", label: "现金券" },
        { prop: "number", label: "数量" },
        { prop: "money", label: "金额" },
        { prop: "integralNumber", label: "积分" },
        // {prop:'integralMoney',label:'积分额'},
        { prop: "payg", label: "现收" },
      ],
      table3: [
        { prop: "recharge", label: "充值" },
        { prop: "cashCoupon", label: "现金券" },
        { prop: "number", label: "数量" },
        { prop: "money", label: "金额" },
        { prop: "integralNumber", label: "积分" },
        // {prop:'integralMoney',label:'积分额'},
        { prop: "payg", label: "现收" },
      ],
      details: {},
      //店员
      personnelNo: "",
      personnelName: "",
      mianRate: "",
      detail: [],

      directSaleNo: document.cookie.match(RegExp("jxStoreNo" + "=([^;]+)"))[1],
    };
  },
  methods: {
    keepgoing() {
      this._getVip();
    },
    //保存
    preservation(data) {
      console.log(data);
      postBuild(JSON.stringify(data)).then((res) => {
        console.log(res.data);
        if (res.data.code == 200) {
          this.$message({
            type: "success",
            message: "保存成功",
          });
          this.showNBData = "none";
          this._getVip();
        } else {
          this.$message.error({ message: "保存失败" });
        }
      });
    },
    //修改
    put(data) {
      this.$confirm("是否修改此VIP的数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          putVip(JSON.stringify(data)).then((res) => {
            console.log(res.data);
            if (res.data.code == 200) {
              this.$message({ type: "success", message: "修改成功" });
              this.showNBData = "none";
              this._getVip();
            } else {
              this.$message.error({ message: "修改失败" });
            }
          });
        })
        .catch(() => {});
    },
    rowClick(e) {
      this.id = e.id;
    },
    //vip新建 删除
    Delete() {
      if (this.id == "") {
        this.$message({ type: "warning", message: "请选择一条数据删除" });
        return;
      }
      this.$confirm(
        "是否删除此VIP的数据(同时会删除账号信息), 是否继续?",
        "提示",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      ).then(() => {
        deleVip({ id: this.id }).then((res) => {
          console.log(res.data);
          if (res.data.code == 200) {
            this.$message({
              type: "success",
              message: "删除成功",
            });
            this._getVip();
          } else {
            this.$message.error({ message: "删除失败" });
          }
        });
      });
    },

    _getVip() {
      this.vipList = [];
      getVip({ directSaleNo: this.directSaleNo }).then((res) => {
        console.log(res.data);
        this.tableData = res.data.data;
        this.tableData.forEach((e) => {
          this.vipList.push({ value: e.phone, label: e.phone, value1: e.name });
        });
      });
    },
    dbClick(e) {
      console.log(e);
      if (localStorage.getItem("whatState") != "直营") {
        this.$message("非直营客户不可更改数据");
        return;
      }
      this.title = "编辑";
      this.showNBData = "block";
      this.details = e;
    },

    //店员 保存
    preservationClerk() {
      // for(let a of this.aList){
      //   if(this.personnelNo == a.personnelNo){
      //     this.$message.warning({message:'此编号已存在'})
      //     return
      //   }
      // }
      if (this.clerkId == "") {
        let obj = {
          personnelNo: this.personnelNo,
          personnelName: this.personnelName,
          mianRate: this.mianRate,
        };
        postClerk(JSON.stringify(obj)).then((res) => {
          console.log(res.data);
          if (res.data.code == 200) {
            this.$message({ type: "success", message: "保存成功" });
            this.personnelNo = "";
            this.personnelName = "";
            this._getClerk1();
          } else {
            this.$message.error({ message: "保存失败" });
          }
        });
      }
      if (this.clerkId != "") {
        let obj = {
          personnelNo: this.personnelNo,
          personnelName: this.personnelName,
          mianRate: this.mianRate,
          id: this.clerkId,
        };
        this.$confirm("是否修改此VIP的数据, 是否继续?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }).then(() => {
          putClerk(JSON.stringify(obj)).then((res) => {
            console.log(res.data);
            if (res.data.code == 200) {
              this.$message({ type: "success", message: "修改成功" });
              this._getClerk1();
            } else {
              this.$message.error({ message: "修改失败" });
            }
          });
        });
      }
    },
    inpt() {
      for (let a of this.aList) {
        if (this.personnelNo != a.personnelNo) {
          this.personnelName = "";
        }
      }
    },
    _getClerk1() {
      getClerk1({ directSaleNo: this.directSaleNo }).then((res) => {
        console.log(res.data);
        this.aList = res.data.data;
      });
    },
    rowClick1(e) {
      console.log(e);
      this.personnelNo = e.personnelNo;
      this.personnelName = e.personnelName;
      this.clerkId = e.id;
    },
    //店员删除
    DeleteClerk() {
      this.$confirm(
        "是否删除此VIP的数据(同时会删除账号信息), 是否继续?",
        "提示",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      ).then(() => {
        deleClerk({ id: this.clerkId }).then((res) => {
          if (res.data.code == 200) {
            this.$message({ type: "success", message: "删除成功" });
            this._getClerk1();
          } else {
            this.$message.error({ message: "删除失败" });
          }
        });
      });
    },

    //充值/积分 查询
    quary() {
      if (this.timeDate == "") {
        var obj3 = {
          vip: this.vip,
          rechargeType: this.rechargeType,
        };
      } else if (this.timeDate != "") {
        var obj3 = {
          rechargeType: this.rechargeType,
          vip: this.vip,
          startTime:
            this.timeDate == null
              ? ""
              : this.timeDate[0] == undefined
              ? ""
              : this.timeDate[0] + " 00:00:00",
          endTime:
            this.timeDate == null
              ? ""
              : this.timeDate[1] == undefined
              ? ""
              : this.timeDate[1] + " 23:59:59",
        };
      }
      console.log(obj3);
      getRecharge(obj3).then((res) => {
        console.log(res.data);
        for (let z in res.data.data) {
          res.data.data[z]["month"] = res.data.data[z].sellTime.slice(5, 7);
          res.data.data[z]["obj"] = "obj";
          if (this.checked == true) {
            if (res.data.data[z].recharge == 0) {
              delete res.data.data[z]; //充值为0的 不显示
            }
          }
        }
        if (this.NumberListStr == "月汇总") {
          let tem = {};
          for (let u in res.data.data) {
            //月份相同 别的元素相加并且合并
            let keyOne = res.data.data[u].month;
            if (tem[keyOne]) {
              tem[keyOne].month = res.data.data[u].month;
              tem[keyOne].recharge += Number(res.data.data[u].recharge);
              tem[keyOne].cashCoupon += Number(res.data.data[u].cashCoupon);
              tem[keyOne].number += Number(res.data.data[u].number);
              tem[keyOne].money += Number(res.data.data[u].money);
              tem[keyOne].integralNumber += Number(
                res.data.data[u].integralNumber
              );
              tem[keyOne].payg += Number(res.data.data[u].payg);
            } else {
              tem[keyOne] = {};
              tem[keyOne].month = res.data.data[u].month;
              tem[keyOne].recharge = res.data.data[u].recharge;
              tem[keyOne].cashCoupon = res.data.data[u].cashCoupon;
              tem[keyOne].number = res.data.data[u].number;
              tem[keyOne].money = res.data.data[u].money;
              tem[keyOne].integralNumber = res.data.data[u].integralNumber;
              tem[keyOne].payg = res.data.data[u].payg;
            }
          }
          let saveList = [];
          for (let i in tem) {
            saveList.push(tem[i]);
          }
          console.log(saveList);
          this.tableData1 = saveList;
          return;
        } else if (this.NumberListStr == "汇总") {
          var tem = {};
          for (let u in res.data.data) {
            //月份相同 别的元素相加并且合并
            var keyOne = res.data.data[u].obj;
            if (tem[keyOne]) {
              tem[keyOne].obj = res.data.data[u].obj;
              tem[keyOne].recharge += Number(res.data.data[u].recharge);
              tem[keyOne].cashCoupon += Number(res.data.data[u].cashCoupon);
              tem[keyOne].number += Number(res.data.data[u].number);
              tem[keyOne].money += Number(res.data.data[u].money);
              tem[keyOne].integralNumber += Number(
                res.data.data[u].integralNumber
              );
              tem[keyOne].payg += Number(res.data.data[u].payg);
            } else {
              tem[keyOne] = {};
              tem[keyOne].obj = res.data.data[u].obj;
              tem[keyOne].recharge = res.data.data[u].recharge;
              tem[keyOne].cashCoupon = res.data.data[u].cashCoupon;
              tem[keyOne].number = res.data.data[u].number;
              tem[keyOne].money = res.data.data[u].money;
              tem[keyOne].integralNumber = res.data.data[u].integralNumber;
              tem[keyOne].payg = res.data.data[u].payg;
            }
          }
          let saveList = [];
          for (let i in tem) {
            saveList.push(tem[i]);
          }
          console.log(saveList);
          this.tableData1 = saveList;
          return;
        } else {
          this.tableData1 = res.data.data;
        }
      });
      //余额
      if (this.vip == "") return;
      getmoney({ vip: this.vip }).then((res) => {
        console.log(res.data);
        if (res.data.code == 200 && res.data.data != null) {
          this.Howmany = res.data.data.balance;
        } else {
          this.Howmany = "";
        }
      });
    },
    //充值
    ChongZhi() {
      if (this.vip == "") {
        this.$message({ type: "warning", message: "请选择vip" });
        return;
      }
      if (this.recharge == "") {
        this.$message({ type: "warning", message: "充值金额不能为空" });
        return;
      }
      let obj = {
        rechargeType: this.rechargeType,
        vip: this.vip,
        recharge: this.recharge,
        cashCoupon: this.cashCoupon == "" ? 0 : this.cashCoupon,
      };
      Recharge(obj).then((res) => {
        if (res.data.code == 200) {
          this.$message({ type: "success", message: "充值成功" });
          this.serial = res.data.data;
          this.quary();
        } else {
          this.$message.error({ message: "充值失败" });
        }
      });
    },
    rowClick2(e) {
      console.log(e);
      this.detail = e;
    },
    //充值  删除
    dele() {
      if ([this.detail] == "") {
        this.$message.warning({ message: "请选中一条数据删除" });
        return;
      }
      for (let x of [this.detail]) {
        console.log(x.sellTime);
        if (
          x.sellTime.slice(0, 10) != this.time.slice(0, 10) ||
          x.recharge == 0
        ) {
          this.$message.warning({
            message: "只能删除当天数据和充值不为0的数据",
          });
        } else if (
          x.sellTime.slice(0, 10) == this.time.slice(0, 10) &&
          x.recharge != 0
        ) {
          // console.log(this.detail)
          x.sellTime = x.sellTime + " 00:00:00";
          DeleteRecharge(this.detail).then((res) => {
            console.log(res.data);
            if (res.data.code == 200) {
              this.$message.success({ message: "删除成功" });
              this.quary();
            } else {
              this.$message.error({ message: "删除失败" });
            }
          });
        }
      }
    },
    //合计汇总
    getList(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "合计";
          return;
        }
        const values = data.map((item) => Number(item[column.property]));
        if (
          column.property === "recharge" ||
          column.property === "cashCoupon" ||
          column.property === "number" ||
          column.property === "money" ||
          column.property === "integralNumber" ||
          column.property === "payg"
        ) {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr);
            if (!isNaN(value)) {
              return prev + curr;
            } else {
              return prev;
            }
          }, 0);
          sums[index];
        }
      });
      return sums;
    },
    //积分设置
    save() {
      let obj = {
        exchangeMoney: this.exchangeMoney,
        exchangeIntegral: this.exchangeIntegral,
        id: this.sendId,
      };
      postIntegral(obj).then((res) => {
        console.log(res.data);
        if (res.data.code == 200) {
          this.$message.success({ message: "设置成功" });
        } else {
          this.$message.error({ message: "设置失败" });
        }
      });
    },
    // removeByValue(arr, attr, value)//删除 attr为value的一条对象
    // {
    //   var index=0;
    //   for(var i in arr){
    //     if(arr[i][attr]==value){
    //       index=i;
    //       break;
    //     }
    //   }
    //   arr.splice(index,1);
    // }
  },
  watch: {
    personnelNo(a, b) {
      if (a != undefined) {
        this.personnelNo = a.toUpperCase().trim();
      }
    },
    personnelName(a, b) {
      if (a != undefined) {
        this.personnelName = a.toUpperCase().trim();
      }
    },
    NumberListStr(a, b) {
      if (a == "明细") {
        this.tab = this.table1;
      } else if (a == "月汇总") {
        this.tab = this.table2;
      } else {
        this.tab = this.table3;
      }
    },
    checked(a, b) {
      if (a) {
        var arr = [];
        for (let y of this.tableData1) {
          if (y.recharge != 0) {
            arr.push(y);
          }
          this.tableData1 = arr;
        }
      } else {
        this.tableData1 = this.tableData1;
      }
    },
  },
};
</script>
